package org.shj.spark.streaming

import org.apache.spark.streaming.StreamingContext
import org.apache.spark.SparkConf
import org.apache.spark.streaming.Seconds

object RecoveryContext {
  def main(args: Array[String]): Unit = {
    val checkpointPath = "D:/download/sparkoutput"
    val ssc = StreamingContext.getOrCreate(checkpointPath, createContext _) //??? 这个下划线是啥意思？
  }
  
  def createContext(): StreamingContext = {
    val conf = new SparkConf().setAppName("Streaming2Dataset")
    conf.setMaster("local[*]")
    val ssc = new StreamingContext(conf, Seconds(5))    
    ssc.sparkContext.setLogLevel("WARN")
    
    ssc.checkpoint("D:/download/sparkoutput") 
    ssc
  }
}